home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / networking / 3363 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  16.9 KB

  1. Path: comma.rhein.de!serpens!not-for-mail
  2. From: mlelstv@serpens.rhein.de (Michael van Elst)
  3. Newsgroups: comp.sys.amiga.networking
  4. Subject: Re: Announce: AWeb 1.0 released!
  5. Date: 2 Apr 1996 12:17:15 +0200
  6. Organization: dis-
  7. Message-ID: <4jqurb$hkf@serpens.rhein.de>
  8. References: <4iva78$5pa@news.xs4all.nl> <4j1f6e$984@news.uni-c.dk> <jasonb.827822336@cs.uwa.edu.au> <4j8o6r$9vj@serpens.rhein.de> <jasonb.827896888@cs.uwa.edu.au> <4jaue8$jh4@serpens.rhein.de> <jasonb.827996764@cs.uwa.edu.au> <4je3qj$kk@serpens.rhein.de> <jasonb.828076494@cs.uwa.edu.au> <4jgdfr$8f4@serpens.rhein.de> <jasonb.828104646@cs.uwa.edu.au> <4jh986$a5o@serpens.rhein.de> <jasonb.828179619@cs.uwa.edu.au> <4jjcc7$hm4@serpens.rhein.de> <jasonb.828426701@cs.uwa.edu.au>
  9. NNTP-Posting-Host: serpens.rhein.de
  10.  
  11. jasonb@cs.uwa.edu.au (Jason S Birch) writes:
  12.  
  13. >mlelstv@serpens.rhein.de (Michael van Elst) writes:
  14. >>But why should every single program manage priorities when there is
  15. >>a more easy solution ?
  16.  
  17. >Firstly, not every single program needs to do it -- only a program
  18. >that wants to do some heavy computation and still interact with the
  19. >user.
  20.  
  21. No. Every program that needs "heavy computation" for a noticable time.
  22.  
  23. >The best way to do that is create a thread, and if you're
  24. >creating a thread anyway you may as well use a value other than "0"
  25. >for the priority when you call CreateNewProc() (or others), right?
  26.  
  27. As I said, there are two ways. You could also create a thread for your
  28. important interactive work (or use an existing one like input.device or
  29. CON).
  30.  
  31. >Secondly, this allows a much simpler programming model for MUI that
  32. >doesn't require locking and semaphore protecting of all data
  33. >structures just to use the OO mechanism. 
  34.  
  35. MUI does use the same OO mechanism. It does need semaphore protection
  36. if you spawn a new task that uses the GUI. And MUI (currently) doesn't
  37. let you spawn tasks to handle the gadgets which would need semaphore
  38. protection too.
  39.  
  40. >What you propose is for some MUI attributes to be modifiable by
  41. >input.device, and/or some MUI methods to be callable by input.device.
  42.  
  43. That's what every standard gadget does.
  44.  
  45. >Currently they are not -- only *one* thread may do MUI stuff, which
  46. >greatly reduces the complexity of programming MUI classes.
  47.  
  48. This is indeed the case. But it has its drawbacks and you need to
  49. take care about this in other programs. So what is easier ? Take
  50. care of the problem in the GUI toolkit or take care of it in every
  51. program ?
  52.  
  53. >Programmers of MUI are supposed to use an OO paradigm. That means
  54. >creating custom classes for everything, rather than simply writing an
  55. >iterative program that uses a GUI toolkit.
  56.  
  57. No.
  58.  
  59. >It also means that writing
  60. >custom classes should be easy, so the OO mechanism itself should not
  61. >require you to deal with the possibility of multiple contexts
  62. >executing your class.
  63.  
  64. No.
  65.  
  66. >>Programmers that use the toolkit do not have care about any internals
  67. >>and programmers of new classes have to know the internals of the toolkit.
  68. >>There is no difference.
  69.  
  70. >The "internals" in this case are the details of the OO mechanism,
  71. >BOOPSI. All you need to know is how to register a new class and its
  72. >dispatcher, and how to receive methods -- just the basic BOOPSI stuff
  73. >(although it's simplified a bit by some MUI glue routines). You don't
  74. >have to worry about locking of structures or anything like that,
  75. >because you're guaranteed never to have more than one context ever
  76. >sending methods to your class.
  77.  
  78. That's easier and less capable. If you want to defer GUI operations
  79. to a low-priority task then your class has to create a new thread
  80. and again you have to communicate and synchronize.
  81.  
  82. >Enabling different contexts to send
  83. >methods (such as input.device telling you to draw yourself in a
  84. >depressed state) would require you to be aware of these issues.
  85.  
  86. It is more work. Sure. But it lets you concentrate the work in the
  87. toolkit.
  88.  
  89. >>No. If you invoke a method from the user's program the priority isn't
  90. >>suddenly changed and the method is not executed by input.device.
  91.  
  92. >This is correct, and is entirely consistent to that which you just
  93. >said "No" to.
  94.  
  95. *sigh*
  96.  
  97. >>As I said, MUI uses the same OO mechanism as gadgetclass.
  98.  
  99. >Yes, MUI and gadgetclass both use BOOPSI. However MUI is *not*
  100. >subclassed from gadgetclass.
  101.  
  102. >It's funny, but I'm sure I saw you complaining about this last year,
  103. >so I assumed you knew it. Hmm... Perhaps it was someone else.
  104.  
  105. Perhaps you don't listen ? gadgetclass methods are called from
  106. the application and from input.device. So it is not always the
  107. same context. A method called from the application is not executed
  108. at priority 20 and if the application tells the gadget to refresh
  109. this happens at the priority of the application.
  110.  
  111. >>>Within those other contexts, you
  112. >>>can't call methods and set attributes of other objects directly.
  113.  
  114. >>This is wrong. Of course you can do this. 
  115.  
  116. >No, you cannot. You are not allowed to send methods and set attributes
  117. >to/of MUI objects unless they are on the same context.
  118.  
  119. I was talking about BOOPSI, not about MUI.
  120.  
  121. >>In fact, even simple
  122. >>gadgetclass objects are created and configured on the application
  123. >>context, event handling and refresh are done on input.device context.
  124.  
  125. >Yep -- gadgetclass objects do that alright. You're right on the money
  126. >there. MUI objects, however, are not gadgetclass objects.
  127.  
  128. I'm not sure what you want to say with this. Obviously MUI objects
  129. are not gadgetclass objects. This is one of the problems
  130.  
  131. >Yes. And look at what happens when the programmer isn't being *very*
  132. >careful -- AmigaGuide.datatype and Grapevine's scrolling text display. 
  133.  
  134. No need to be careful.
  135.  
  136. >If you leave it up to the programmer and they make a mistake (which is
  137. >easy enough), you can wind up with jerky mouse pointers using that
  138. >system.
  139.  
  140. Same as with MUI that runs on pri 0 for everything.
  141.  
  142. >At least with MUI the worst that can happen is a sluggish
  143. >application. The rest of the system is fine.
  144.  
  145. Same with careless design of gadgetclass gadgets. The rest of the
  146. system is fine. I mean, the only thing we want to achieve with
  147. priorities IS user responsiveness.
  148.  
  149. >Well, there is another way -- each MUI program could run its event loop
  150. >at pri 1. :-) However that's not necessary. As I said, the worst that
  151. >happens is the app becomes unresponsive, and that can be fixed simply
  152. >by the user or the programs responsible or something like Executive
  153. >running CPU intensive tasks at a lower priority.
  154.  
  155. So you have to "fix" all the programs or run "Executive" which does the
  156. "fixes" automatically to use MUI.
  157.  
  158. >>On the other hand it is simple to rely on input.device to run at pri
  159. >>20 ahead of all other tasks.
  160.  
  161. >Sure -- and get frozen mouse pointers when you screw up,
  162.  
  163. So when you screw up with MUI there are no problems ?
  164.  
  165. >have locking
  166. >problems associated with two different threads of execution running
  167. >through your custom classes,
  168.  
  169. I don't think that you have problems. It is fairly easy.
  170.  
  171. >or having special cases for a few simple
  172. >gadgets that can be cheaply refreshed by Intuition, etc.
  173.  
  174. It is not "a few simple gadgets". It is "close to all gadgets" because
  175. every gadget has to generate feedback.
  176.  
  177. >At least with MUI, when you *do* spawn a task, it's entirely under your
  178. >control. It has nothing to do with MUI, it will never be touched by
  179. >MUI, it is a simple, normal, subtask. As I said, the subtasking has
  180. >nothing to do with your OO system, which keeps the OO system simple.
  181.  
  182. The OO system is the same as that for gadgetclass.
  183.  
  184. >>As I said this is a flaw in the AmigaGuide datatype.
  185.  
  186. >Yep. Even a professional programmer at C= can make a mistake.
  187.  
  188. Guess how old the datatype is, and no, that's not a mistake, it is
  189. just not optimal.
  190.  
  191. And I bet that all the people _using_ the AmigaGuide datatype
  192. wouldn't care.
  193.  
  194. >Imagine
  195. >if the programmers of all those MUI programs on Aminet were exposed to
  196. >the same difficulties...
  197.  
  198. Oh, but they _are_ exposed to the same difficulties. Have a look at all
  199. the MUI applications that do not spawn subtasks for everything CPU
  200. intensive. And then count the number of people that actually implement
  201. MUI subclasses.
  202.  
  203. >"Sensible" in this case is obviously very much a matter of taste. I'd
  204. >rather something that was simple, uniform, and completely general with
  205. >no special cases and "gotcha"'s.
  206.  
  207. There are enough gotchas in either system. But AFAIK there are more
  208. people using a GUI toolkit than writing one, and that's why I prefer
  209. the gotchas in the toolkit.
  210.  
  211. >>That's why you do not want to run the GUI at this priority.
  212.  
  213. >*NOT* just the GUI. Making 'ls' eight times slower by running just two
  214. >tasks isn't helped by a pri 20 GUI.
  215.  
  216. But running it at pri 20 ensures that it is responsive.
  217.  
  218. >Nope, the GUI will depress buttons fine. But the delay in characters
  219. >appearing that you have typed will more than compensate.
  220.  
  221. Why ?
  222.  
  223. >That delay
  224. >won't exist if the CPU intensive stuff is at a lower priority.
  225.  
  226. Or if the whole text entry runs at the high priority (have a look
  227. at string gadgets).
  228.  
  229. >>That's obvious. If the machine is busy then it becomes slower.
  230.  
  231. >It needn't.
  232.  
  233. It does.
  234.  
  235. >If I run 20 CPU intensive processes at pri 0, the machine
  236. >is practically unuseable.
  237.  
  238. Sure. <5% of the CPU isn't much to be proud of.
  239.  
  240. >Running interactive stuff at a higher priority doesn't cause the CPU
  241. >intensive stuff to miss out on any cycles they would've got anyway.
  242. >But running CPU intensive stuff at the same priority has a huge impact
  243. >on the interactive stuff, which keeps giving up portions of their
  244. >quanta and waiting their turn again.
  245.  
  246. That's why you want to run interactive stuff at a higher priority.
  247.  
  248. >You're saying that characters be processed and displayed as they are
  249. >entered, on input.device's context?
  250.  
  251. Yes.
  252.  
  253. >Cut and paste?
  254.  
  255. The highlighting (done by console.device) already happens on
  256. input.device context.
  257.  
  258. >Reformatting as you
  259. >type?
  260.  
  261. Is too slow anyway and is defered to a subtask.
  262.  
  263. >Online spell checking?
  264.  
  265. Produces no visual feedback and is CPU intensive anyway.
  266.  
  267. >The text editor probably won't be
  268. >sluggish, but I bet your pointer sure becomes jerky and you'd want to
  269. >avoid using your serial port for anything important.
  270.  
  271. No, why ? The high priority is just used to provide feedback.
  272.  
  273. >>>It isn't responsive if (gasp) I run another CPU intensive task at
  274. >>>priority 0,
  275. >>It is more responsive than a MUI application under the same condition.
  276. >Yes. You are perfectly correct. Does that mean all apps should
  277. >"suffer" because it "hurts" MUI more?
  278.  
  279. I'm just saying that MUI needs a smart scheduler as much as you running
  280. lots of CPU intensive tasks in the background. On the other hand you
  281. do not even use Executive to schedule everything. What happens to MUI
  282. when you have a task that does lots of small I/O through the filesystem
  283. (at pri 5 and 10) ?
  284.  
  285. Using a static priority scheme for the GUI (and other system tasks) is
  286. much easier. This doesn't mean that a smart scheduler couldn't be used
  287. for other programs where the scheduling algorithm is more appropriate.
  288.  
  289. >>Overloading a machine is never fast and changing priorities won't
  290. >>change that.
  291.  
  292. >Of course it does. I suggest you try it sometime. Remember, AmigaOS
  293. >isn't like Unix.
  294.  
  295. I remember that you use Executive which tries to make AmigaOS to
  296. behave like UNIX.
  297.  
  298. >(As an aside -- using more threads, thanks to Exec's scheduler, will
  299. >actually make your program relatively *faster* in a heavily loaded
  300. >environment. Run 10 CPU intensive tasks, compare two programs A & B
  301. >which do the same thing. A uses one thread, B uses 10. B will get
  302. >about 1/2 the CPU in total, A will get about 10%. Guess which will go
  303. >faster...)
  304.  
  305. Makes much sense, no ?
  306.  
  307. >Don't be rediculous. It's only a problem if the CPU intensive operation
  308. >goes for long enough for the user to switch to another, interactive,
  309. >task, and say "Oh, boy, this is unresponsive".
  310.  
  311. No. These programs could run in the background from a script and when
  312. the interactive application he uses becomes sluggish he knows why.
  313.  
  314. >Umm... Let me think. I would say the easiest way would be to do it
  315. >like AmigaGuide.datatype does it? Am I wrong? Has the
  316. >AmigaGuide.datatype actually done it the hard way?
  317.  
  318. So, besides the flawed AmigaGuide.datatype, do you have another example ?
  319.  
  320. >From the programmers point of view, an OO system that doesn't
  321. >*require* the programmer to worry about multiple contexts calling his
  322. >custom class, and provides a consistent and complete mechanism for all
  323. >classes, sounds like the simplest way to go.
  324.  
  325. If the programmer writes new classes.
  326.  
  327. >then it doesn't make any difference to use a
  328. >"-1" for its priority instead of "0".
  329.  
  330. And it doesn't make a difference to use no thread because the GUI
  331. toolkit already knows how to deal with user input quickly.
  332.  
  333. >>But you do care wether AWeb presents you a page while loading or
  334. >>wether Executive prevents this.
  335.  
  336. >The page was presented while loading. AWeb simply didn't respond to
  337. >input. A special entry in Executive fixed this.
  338.  
  339. Sure. A special entry that effectively disabled Executive for AWeb
  340. stopped Executive from interfering with AWebs output.
  341.  
  342. >IBrowse also presents
  343. >a page while loading and responds to input, with or without Executive.
  344. >It didn't need a special entry.
  345.  
  346. It does. You need to start Executive in the first place.
  347.  
  348. This just shows that Executive isn't the perfect solution. It works
  349. fine with some types of programs and causes problems with other types
  350. of programs.
  351.  
  352. >>But it makes a difference when the process is important and not
  353. >>only the completition of the process.
  354.  
  355. >But it won't be starved of CPU by the event loop, now, will it?
  356.  
  357. Huh ? How can it be starved by the event loop ? The event loop doesn't
  358. need much CPU time.
  359.  
  360. >Remember, I was suggesting run *all* CPU intensive subtasks at the
  361. >same, lower priority.
  362.  
  363. ... which is impractical.
  364.  
  365. >The event loop doesn't take much, and you want
  366. >that to get the CPU immediately whenever you click something, anyway.
  367.  
  368. I get the CPU immediately when I process the event where it is
  369. generated (i.e. in the input.device task). This is no longer
  370. Intuition V33. Thanks to BOOPSI and gadgetclass I can now process
  371. events and create feedback even for reasonable complex gadgets.
  372.  
  373. >once. If you were running Executive you would probably want to use one
  374. >of the better schedulers or make a special entry in this case.
  375.  
  376. Or simply do not use Executive and run all the animations at some
  377. equal reasonable priority.
  378.  
  379. >Not if they spawn lower priority subtasks for the CPU intensive stuff.
  380. >AWeb already spawns subtasks, they're just at the wrong priority.
  381.  
  382. I fail to see that :) They are just at a priority that isn't handled
  383. well by the Executive scheduler (but nicely by the Exec scheduler).
  384.  
  385. >>Are you complaining about AWeb not displaying a page while loading ?
  386.  
  387. >Did you read my post? AWeb displayed a page while loading fine. It just
  388. >didn't respond to user input.
  389.  
  390. I was refering to the claim that it did not display the page while
  391. loading.
  392.  
  393. >displayed -- but the clicks on the gadgets went unheeded until the page
  394. >was finished 2 1/2 minutes later
  395.  
  396. Sure, when Executive stalls the event loop then this is what happens.
  397.  
  398. >You
  399. >claim MUI is the reason for wanting this and you don't need it
  400. >otherwise.
  401.  
  402. No. I claim that you need it for MUI. MUI is _a_ reason. I never said
  403. that you don't want it otherwise.
  404.  
  405. >of the CPU pie. They can't save it until later. Exec's scheduler is
  406. >deadly for I/O bound tasks under a heavy load.
  407.  
  408. Not really. If a task is I/O bound then it just waits and doesn't
  409. need much CPU time. Some CPU is spent in the I/O handler processes
  410. and drivers (that's why they run at a high priority). Obviously
  411. the RAM disk or PIPEs are a worst case.
  412.  
  413. >displayed, all perfectly -- with the one small problem that no user
  414. >input was processed while Executive was fiddling with priorities. Weird.
  415.  
  416. Weird ? No. "Doctor, Doctor, when I run Executive then AWeb doesn't
  417. handle user input while processing images." - "Well, then don't do that."
  418.  
  419. No ?
  420.  
  421. >consistent with 157s for a 600k page. Are you getting much less than
  422. >12s for 50k pages (this is across ethernet, BTW)?
  423.  
  424. Maybe 3 or 4 seconds (with no graphics, graphics depend on datatypes
  425. speed), part of this is rendering.
  426.  
  427. >>You can only stop network activity.
  428.  
  429. >That's a shame. I'd prefer it to progressively display pages as it got
  430. >them from the cache, like it does when transferring them across the
  431. >network.
  432.  
  433. Well, to me it looks as if it does this. But you cannot abort it which
  434. would be a nice feature to add.
  435.  
  436. >Then I could click on them or go somewhere else without
  437. >having to wait for it to finish. Currently it just locks up until the
  438. >page is ready to be displayed.
  439.  
  440. It doesn't lock up here.
  441.  
  442. >>IBrowse becomes sluggish without Executive too.
  443.  
  444. >Yes, if you're running other CPU intensive tasks at the same priority.
  445.  
  446. That's what I'm saying.
  447.  
  448. >>And running interactive tasks at a high priority does the same and
  449. >>was done by Intuition - to some degree - all the time. 
  450.  
  451. >It does *not* make the apps more responsive. *All* it does is make a
  452. >few gadgets visually respond quickly.
  453.  
  454. It makes all gadets visually respond quickly. And that's what you want.
  455.  
  456. >The apps themselves will take
  457. >longer to process your input --
  458.  
  459. Which is obvious, the machine is overloaded.
  460.  
  461. -- 
  462.                                 Michael van Elst
  463.  
  464. Internet: mlelstv@serpens.rhein.de
  465.                                 "A potential Snark may lurk in every tree."
  466.